import lombok.SneakyThrows;

import java.net.ServerSocket;
import java.net.Socket;

public class User {

    @SneakyThrows
    public static void main(String[] args) {

        // 作为服务端监听连接

        //初始化ServerSocket
        ServerSocket server = new ServerSocket(2000);


        System.out.print("please input user inet4 address:");
        //阻塞等待客户端连接，初始化Socket
        Socket client = server.accept();
        System.out.println(client.getInetAddress().getHostName() + "/" + client.getInetAddress().getHostAddress() + " connection succeeded.");

        // 作为客户端发送请求
    }
}
